package com.gitee.zycra.union.api.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zycra
 */
public enum RequestParamTypeEnum {

    /**
     * 入参类型
     */
    QUERY(1, "拼接"),
    FORM(2, "表单"),
    JSON(3, "JSON");

    private static final Map<Integer, RequestParamTypeEnum> MAP = new HashMap<>();

    static {
        for (RequestParamTypeEnum value : RequestParamTypeEnum.values()) {
            MAP.put(value.getCode(), value);
        }
    }

    /**
     * 枚举值
     */
    private final Integer code;

    /**
     * 枚举描述
     */
    private final String desc;

    RequestParamTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static RequestParamTypeEnum getByCode(Integer code) {
        return MAP.get(code);
    }
}
